package com.edu.exam.enums.grading;

/**
 * 配置环境枚举
 */
public enum ConfigEnvironment {
    ALL("ALL", "全部环境"),
    DEVELOPMENT("DEVELOPMENT", "开发环境"),
    TESTING("TESTING", "测试环境"),
    STAGING("STAGING", "预发环境"),
    PRODUCTION("PRODUCTION", "生产环境");

    private final String code;
    private final String description;

    ConfigEnvironment(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static ConfigEnvironment fromCode(String code) {
        for (ConfigEnvironment environment : values()) {
            if (environment.getCode().equals(code)) {
                return environment;
            }
        }
        return ALL; // 默认返回全部环境
    }
}